﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Xml;

namespace iLangl.Tests.XmlFixture
{
	[TestClass]
	public class CompareXmlFixtureTest
	{
		
		[TestMethod]
		public void CompareXmlStructureTest()
		{
			string source = @"<source><text>bla bla</text></source>";
			string target= @"<source><text>test</text><v>tada</v></source>";


			XMLManager.XMLValidationResult result = XMLManager.Instance.Compare(source, target);
			Assert.IsTrue(result.isSourceXml);
			Assert.IsTrue(result.isTargetXml);
			Assert.IsFalse(result.IsStructureTheSame);
			Assert.IsFalse(result.IsDataTheSame);
			
			source = @"<text>bla bla</text>";
			target = @"<text>bla bla</text>";

			result = XMLManager.Instance.Compare(source, target);
			Assert.IsTrue(result.isSourceXml);
			Assert.IsTrue(result.isTargetXml);
			Assert.IsTrue(result.IsStructureTheSame);
			Assert.IsTrue(result.IsDataTheSame);

			source = @"<text>bla bla</text>";
			target = @"<text>change</text>";

			result = XMLManager.Instance.Compare(source, target);
			Assert.IsTrue(result.isSourceXml);
			Assert.IsTrue(result.isTargetXml);
			Assert.IsTrue(result.IsStructureTheSame);
			Assert.IsFalse(result.IsDataTheSame);
		}


	}
}
